﻿@{
    Ajax.Dna().Widget()
        .Content(@<text>
    @{ 
        string _url = item.GetData<string>("Url");
        if (string.IsNullOrEmpty(_url))
        {
          _url= "javascript:void(0);";
        }
        else
        {
            if (_url.ToLower().StartsWith("javascript:") && !_url.Equals("javascript:void(0);", StringComparison.OrdinalIgnoreCase))
            {     
                _url = "javascript:void(0);";
            }
        }
        
        var _target = !string.IsNullOrEmpty(item.UserPreferences["TargetName"] as string) ? item.UserPreferences["TargetName"].ToString() : (item.IDPrefix + "_frame");
    }
    <iframe src="@_url" name="@_target" style="width: 100%;border:0;" height="@item.UserPreferences["Height"]">
    </iframe>
    </text>)
.Preview(@<text>
<h2>There is your html content body</h2>
<p>Set the url to display the external html content.</p>
</text>)
        .Render();
}
